﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.ResourcesAPI
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Derive from this base class to provide alternative implementations to the C# behavior of specific Resources methods.</para>
  /// </summary>
  public class ResourcesAPI
  {
    private static ResourcesAPI s_DefaultAPI = new ResourcesAPI();

    internal static ResourcesAPI ActiveAPI => ResourcesAPI.overrideAPI ?? ResourcesAPI.s_DefaultAPI;

    /// <summary>
    ///   <para>The specific ResourcesAPI instance to use to handle overridden Resources methods.</para>
    /// </summary>
    public static ResourcesAPI overrideAPI { get; set; }

    protected internal ResourcesAPI()
    {
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the Resources.FindObjectsOfTypeAll function.</para>
    /// </summary>
    /// <param name="systemTypeInstance"></param>
    protected internal virtual Object[] FindObjectsOfTypeAll(System.Type systemTypeInstance)
    {
      return ResourcesAPIInternal.FindObjectsOfTypeAll(systemTypeInstance);
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the Shader.Find function.</para>
    /// </summary>
    /// <param name="name"></param>
    protected internal virtual Shader FindShaderByName(string name)
    {
      return ResourcesAPIInternal.FindShaderByName(name);
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the Resources.Load function.</para>
    /// </summary>
    /// <param name="path">Path to the target resource to load.</param>
    /// <param name="systemTypeInstance">The requested asset's Type.</param>
    /// <returns>
    ///   <para>The requested asset returned as an Object.</para>
    /// </returns>
    protected internal virtual Object Load(string path, System.Type systemTypeInstance)
    {
      return ResourcesAPIInternal.Load(path, systemTypeInstance);
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the Resources.LoadAll function.</para>
    /// </summary>
    /// <param name="path">Path to the target resource to load.</param>
    /// <param name="systemTypeInstance">Type filter for objects returned.</param>
    protected internal virtual Object[] LoadAll(string path, System.Type systemTypeInstance)
    {
      return ResourcesAPIInternal.LoadAll(path, systemTypeInstance);
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the Resources.LoadAsync function.</para>
    /// </summary>
    /// <param name="path">Path to the target resource to load.</param>
    /// <param name="systemTypeInstance">Type filter for objects returned.</param>
    protected internal virtual ResourceRequest LoadAsync(string path, System.Type systemTypeInstance)
    {
      ResourceRequest resourceRequest = ResourcesAPIInternal.LoadAsyncInternal(path, systemTypeInstance);
      resourceRequest.m_Path = path;
      resourceRequest.m_Type = systemTypeInstance;
      return resourceRequest;
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the Resources.Unload function.</para>
    /// </summary>
    /// <param name="assetToUnload"></param>
    protected internal virtual void UnloadAsset(Object assetToUnload)
    {
      ResourcesAPIInternal.UnloadAsset(assetToUnload);
    }
  }
}
